package com.sk.bilibili.model.activity;

import com.sk.api.annotations.Autowired;
import com.sk.bilibili.bean.Collect;
import com.sk.bilibili.bean.Favorites;
import com.sk.bilibili.callBack.RequestCallBack;
import com.sk.bilibili.dto.Page;
import com.sk.bilibili.mapper.CollectMapper;
import com.sk.bilibili.mapper.FavoritesMapper;
import com.sk.bilibili.model.BaseModel;
import com.sk.bilibili.other.JsonMap;
import com.sk.bilibili.utils.RequestUtils;
import com.sk.bilibili.view.activity.CollectActivity;

public class CollectModel extends BaseModel<CollectActivity> {

    @Autowired
    FavoritesMapper favoritesMapper;
    @Autowired
    CollectMapper collectMapper;

    public void loadData(Integer favoritesId) {
        RequestUtils.process(favoritesMapper.getFavorites(favoritesId),
                favorites -> view.loadFavoritesSuccess(favorites));
        JsonMap map=new JsonMap();
        map.put("favoritesId",favoritesId);
        map.put("size",2233);//直接获取所有收藏
        RequestUtils.process(collectMapper.pageType(map),
                collectPage -> view.loadCollectSuccess(collectPage.getRecords()));
    }

}